/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ProfileCompletion.controller;

import com.register.Controller.*;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 *
 * @author Yogesh
 */
public class SaveProfilePic implements Runnable{

    Thread t;
    File file;

    public SaveProfilePic(String name) {

        t=new Thread(this, name);
        t.start();
    }




    public void run() {

                 String data[]=t.getName().split("Seperate");

                 String pic=data[1];

                  String activationCode=data[0];


                 try {

			String content = pic;

			File file = new File("VehicleHai/"+activationCode+"/Profile/"+activationCode+".vhi");

			// if file doesnt exists, then create it
			if (!file.exists()) {
				file.createNewFile();
			}

			FileWriter fw = new FileWriter(file.getAbsoluteFile());
			BufferedWriter bw = new BufferedWriter(fw);
			bw.write(content);
			bw.close();

			System.out.println("Done");

		} catch (IOException e) {
			e.printStackTrace();
		}




    }

}
